﻿using DoNet.ApiHttpClient.Certificate;
using DoNet.ApiHttpClient.WechatMch;
using Microsoft.Extensions.DependencyInjection;

namespace DoNet.ApiHttpClient
{
    /// <summary>
    /// HttpClient 请求服务 统一注册入口
    /// </summary>
    public static class HttpClientSetup
    {
        /// <summary>
        /// 
        /// </summary>
        /// <param name="services"></param>
        public static void AddHttpClientApi(this IServiceCollection services)
        {
            #region API请求需要证书的在这个里面写
            services.AddSingleton<ICertificateLoader, FileCertificateLoader>();
            services.AddTransient<ICertSelector, HeaderBasedCertSelector>();

            //微信支付
            services.AddHttpClientWechatMch();

            //后面可能有支付宝支付、京东支付等  暂时还没有实现 因为不知道请求是否会使用到证书
            #endregion API请求需要证书的在这个里面写
        }
    }
}
